home *** CD-ROM | disk | FTP | other *** search
/ Aminet 41 / Aminet 41 (2001)(Schatztruhe)[!][Feb 2001].iso / Aminet / comm / net / tf02.lha / TinyFugue / tf-lib / pcmd.tf < prev    next >
Text File  |  1995-08-12  |  925b  |  38 lines

  1. ;;; prefix/suffix for mud commands
  2. ;; usage:
  3. ;; /pfxrand            - randomize *fixes
  4. ;; /pfxon [-w<world>]        - enable *fixes    on <world>
  5. ;; /pfxoff [-w<world>]        - disable *fixes on <world>
  6. ;; /pcmd [-w<world>] <cmd>    - execute *fixed <cmd> on <world>
  7.  
  8. ;; Programmer's note: the /send commands here deliberately do not have a
  9. ;; leading "-", because we want the -w<world> option to be interpreted.
  10.  
  11. /~loaded pcmd.tf
  12.  
  13. /def -i pfxrand = \
  14.     /set outputprefix=<pre:$[rand()]>%;\
  15.     /set outputsuffix=<suf:$[rand()]>
  16.  
  17. /pfxrand
  18.  
  19. /def -i pfxon = \
  20.     /send %* - OUTPUTPREFIX %{outputprefix}%;\
  21.     /send %* - OUTPUTSUFFIX %{outputsuffix}
  22.  
  23. /def -i pfxoff = \
  24.     /send %* - OUTPUTPREFIX%;\
  25.     /send %* - OUTPUTSUFFIX
  26.  
  27. /def -i pcmd = \
  28.     /let opts=%; \
  29.     /while ( {1} =/ "-[^- ]*" ) \
  30.         /let opts=%opts %1%; \
  31.         /shift%; \
  32.     /done%; \
  33.     /pfxon %{opts}%; \
  34.     /send %{opts} %*%; \
  35.     /pfxoff %{opts}%; \
  36.     /pfxrand
  37.  
  38.